<?php $sever=explode("/index.php", $_SERVER['PHP_SELF']);?>

<div style="width:100%;height:50px;">
<div id="toolbar" class="toolbar"><table class="toolbar"><tbody><tr>
<td><a href="#" onclick="createAction('/CMS_ITGVN_NEW/admin/product/create')">
<span style="background-image: url(<?php echo $sever[0];?>/images/t_cmd_new.png);"></span>
Tạo</a></td>

<td><a href="#" onclick="updateAction('/CMS_ITGVN_NEW/admin/product/create')">
<span style="background-image: url(<?php echo $sever[0];?>/images/t_cmd_edit.png);"></span>
Sửa</a></td>

<td><a href="#" onclick="deleteAction()">
<span style="background-image: url(/zendExam/images/t_cmd_delete.png);"></span>
Xóa</a></td>

</tr></tbody></table>
</div>
</div>
<div>
<form action="" method="post" enctype="multipart/form-data" name="adminForm">
<!-- table search -->
<table>
	<tr>
		<td width="100%" align="left">
		<input type="text" name="search" />
		</td>
		<td><?php echo $this->formSelect('categoryId',$this->categoryId,array("onchange"=>"changeCategory();"),$this->categoryList);?></td>
		
	</tr>
</table>
<!-- end search -->

		<script type="text/javascript">
		$(document).ready(function()
		{
			$("#checkall").click(function()				
			{
				var checked_status = this.checked;
				$("input[@class=chkBox]").each(function()
				{
					this.checked = checked_status;
				});
			});

			$("#checkall").click(function()				
					{
						var checked_status = this.checked;
						$("input[@class=chkBox]").each(function()
						{
							this.checked = checked_status;
						});
			});
								
		});
		
		</script>
<!-- table grid -->
<table class="grid">

	<!-- header -->
	<thead>
		<tr>
			<th width="10px">#</th>
			<th width="5px"><input type="checkbox"  onclick="checkAll()"  ></th>

<th width="230">Product Name</th>
<th width="70">Published</th>
<th width="90">Order
<a href="#" onclick="saveOrders()"><img src="<?php echo $this->baseURL;?>/images/t_cmd_save_orders.png"></a>
</th>
<th width="150">Category</th>
<th width="100">Author</th>
<th width="100">Date</th>
<th width="30">ID</th>
</tr>
	</thead>
	
	<!-- end header -->
		<?php $temp=$this->pro;
		if(count($temp)>0)
		{
			$count=0;
			foreach( $temp as $product){
				//echo $key. $value['productName'].'<br />';
		?>			
			
    <tr>
		<td><?php echo $count+1;?></td>
		<td align="center"><input id="<?php echo "item".$count;?>" type="checkbox" class="chkBox" name="chkBox[]"
			value="<?php echo $product['productId']; ?>"></td>
		<td><?php echo $this->escape($product['productName'] ); ?>
			<div>
				<a href="<?php echo $sever[0];?>/admin/product/delete/id/<?php echo $product['productId'];?>"> Xóa</a>|
				<a href="<?php echo $sever[0];?>/admin/product/create/id/<?php echo $product['productId'];?>">Sửa</a>				
			</div>
			</td>
		<td align="center"><?php echo '<a href="#" onclick="publish('.$product['status'].','.$product['productId'].')">';if($product['status']>0) echo '<img src="'.$sever[0].'/images/t_cmd_publish.png">';else echo'<img src="'.$sever[0].'/images/t_cmd_publish_x.png">'; echo '</a>'; ?></td>
		<td align="center"><input type="text" style="width:40px;" class="order" value="<?php echo $product['ordering']; ?>" /></td>
		<td><?php echo $this->escape($product['categoryName'] ); ?></td>
		<td><?php echo $this->escape($product['userName']); ?></td>
		<td><?php echo $this->escape($product['creationTime'] ); ?></td>
		<td><?php echo $this->escape($product['productId'] ); ?></td>
		<!-- <td><img height="50" src="<?php echo $this->baseURL."/images/products/".$product['thumbnailURL']; ?>"></td> -->
	</tr>
	  <?php
		$count++;
			 }
	}
	?>
</table>
<!-- end table grid -->
    
<table class="paginator">
	<tr>
		<td style="width:80%; margin:0 auto;text-align: center;">
			<?php echo $this->paginator; ?>
		</td>
	</tr>
</table>	


<input type="hidden" name="cmd" id="cmd">
<input type="hidden" name="params" id="params" value="">

</form>
</div>